package solution.T0215_1_Clipboard.command;

import solution.T0215_1_Clipboard.Clipboard;

import java.util.List;
import java.util.function.Consumer;

public class HistoryCommand extends Command {
    private final String keyword;
    private final Consumer<List<CopyCommand>> callback;

    public HistoryCommand(String keyword, Consumer<List<CopyCommand>> callback) {
        this.keyword = keyword;
        this.callback = callback;
    }

    @Override
    public void execute() {
        List<CopyCommand> history = Clipboard.getInstance().getHistory(keyword);
        callback.accept(history);
    }
}